//------------------------------------------------------------------------------
// @description 管理员端-分数总览-进行中-详情
//------------------------------------------------------------------------------
<script setup name="ScoreOverviewProceedDetail">
//------------------------------------------------------------------------------
// 模块引入
//------------------------------------------------------------------------------
import { ref } from 'vue';
import { useRouter } from 'vue-router';

import { ElTable, ElTableColumn, ElPagination, ElSelect, ElOption } from 'element-plus';
import { Search } from '@element-plus/icons-vue';

//------------------------------------------------------------------------------
// 数据存储
//------------------------------------------------------------------------------
const router = useRouter();
const routerQuery = router.currentRoute.value.query;

//表格数据
const tableData = ref([
    {
        name: routerQuery.name,
        id: routerQuery.id,
        taskName: routerQuery.baseWorkName,
        taskState: routerQuery.baseWorkState,
        score: routerQuery.baseWorkScore,
        operation: '详情',
    },
    {
        name: routerQuery.name,
        id: routerQuery.id,
        taskName: routerQuery.outstandingWorkName,
        taskState: routerQuery.outstandingWorkState,
        score: routerQuery.outstandingWorkScore,
        operation: '详情',
    }
]);
const pageNum = ref(1); // 当前页码
const pageSize = ref(5); // 每页显示的条数
const totalSize = ref(0);



//------------------------------------------------------------------------------
// 数据处理方法
//------------------------------------------------------------------------------

//点击详情
const operationClick = (row, column) => {
    if(column.property !== 'operation') {
        return;
    }
    if(row.taskName === tableData.value[0].taskName) {
        router.push({
            path: '/administrator/baseWork/proceed/detail',
            query: { ...row,...routerQuery }
        });
    }
    if(row.taskName === tableData.value[1].taskName) {
        router.push({
            path: '/administrator/outstandingWork/proceed/detail',
            query: { ...row,...routerQuery }
        });
    }
}
</script>

<template>
    <div class="ScoreOverviewProceedDetail">
        <div class="header">
            <span @click="router.push('/administrator/scoreOverview')">进行中-考核情况列表</span>
            <span>/导师情况</span>
        </div>
        <!-- 表格 -->
        <div class="layout">
            <div class="info">
                <div class="infoHeader">{{ routerQuery.taskName }}</div>
                <div class="infoContent">
                    <div class="item">
                        <div class="title">导师姓名</div>
                        <div>阿凡达</div>
                    </div>
                    <div class="item">
                        <div class="title">工号</div>
                        <div>12345678</div>
                    </div>
                    <div class="item">
                        <div class="title">任务名称</div>
                        <div>2020-2021学年突出工作情况</div>
                    </div>
                    <div class="item">
                        <div class="title">考核结果</div>
                        <div>合格</div>
                    </div>
                    <div class="item">
                        <div class="title">考核分数</div>
                        <div>100</div>
                    </div>
                </div>
            </div>
            <div class="dataTable">
                <div class="content">
                    <!-- 搜索框头部 -->
                    <div class="tableHeader">
                        <div class="left">
                            <span>班级填报情况</span>
                        </div>
                        <div class="right" >
                        </div>
                    </div>
                    <!-- 数据表格 -->
                    <div class="tableContent">
                        <el-table
                        :data="tableData"
                        :style="{width: '100%'}"
                        height="100%"
                        empty-text="暂无数据"
                        show-overflow-tooltip
                        :header-cell-style="{color: '#000', background: '#f2f3f5'}"
                        @cell-click="operationClick"
                        >
                            <el-table-column align="left" prop="name" label="姓名" width="100"></el-table-column>
                            <el-table-column align="left" prop="id" label="工号" width="100"></el-table-column>
                            <el-table-column align="center" prop="taskName" label="任务名称" width="250"></el-table-column>
                            <el-table-column align="center" prop="taskState" label="任务状态">
                                <template #default="scope">
                                    <span :color="scope.row.taskState">{{ scope.row.taskState }}</span>
                                </template>
                            </el-table-column>
                            <el-table-column align="center" prop="score" label="分数"></el-table-column>
                            <el-table-column align="center" prop="operation" label="操作" >
                                <template #default="scope">
                                    <span style="color:#5a8cff;">{{ scope.row.operation }}</span>
                                </template>
                            </el-table-column>
                        </el-table>
                    </div>
                    <!-- 底部分页器 -->
                    <div class="tableFooter">
                        <div class="left">
                            <div class="total">共计: {{ tableData.length }} 条</div>
                        </div>
                        <div class="right">
                            <div class="pagination">
                                <el-pagination
                                    v-model="pageNum"
                                    layout="prev, pager, next"
                                    :total="totalSize"
                                    :page-size="pageSize"
                                    background
                                    size="small"
                                />                        
                            </div>
                            <div class="selector">
                                <el-select v-model="pageSize" placeholder="每页条数" style="width: 80px;" size="small">
                                    <el-option label="5条/页" :value="5"></el-option>
                                    <el-option label="10条/页" :value="10"></el-option>
                                    <el-option label="20条/页" :value="20"></el-option>
                                </el-select>
                            </div>
                            <div class="jump">
                                <span class="title">前往:</span>
                                <input type="text" v-model="pageNum">
                            </div>                        
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<style scoped lang="scss">
.ScoreOverviewProceedDetail {
    width: 100%;
    height: 100%;
    .header{
        width: 100%;
        height: 10%;
        padding-left: 15px;
        display: flex;
        align-items: center;
        color:#7f7f7f;
        border-top: 1px solid;
        border-bottom: 1px solid;
        span:hover{
            color:#4c5fbc;
            font-weight: 600;
        }
    }
    .layout{
        width: 100%;
        height: 90%;
        padding: 20px 40px;
        .info{
            width: 100%;
            height: 130px;
            padding: 15px 10px;
            background-color: white;
            border-radius: 5px;
            color:#4e5969;
            font-size: 15px;
            .infoHeader{
                width: 100%;
                height: 30px;
                border-bottom: 1px dashed #000;
                font-size: 18px;
                font-weight: 500;
                color:#000;
            }
            .infoContent{
                width: 100%;
                display: flex;
                flex-wrap: wrap;
                .item{
                    margin-top: 10px;
                    width: 33%;
                    display: flex;
                    align-items: center;
                    .title{
                        margin-right: 10px;
                    }
                }
            }
        }
        .dataTable {
            width: 100%;
            height: calc(100% - 150px);
            margin-top: 20px;
            .content{
                width: 100%;
                height: 100%;                    
                padding: 0 15px;
                background-color: #ffffff;
                border-radius: 10px;
                .tableHeader{
                    width: 100%;
                    height: 15%;
                    display: flex;
                    justify-content: space-between;
                    border-bottom: 1px solid #e5e6eb;
                    font-weight: 600;
                    color:#000;
                    .left {
                        width: 250px;
                        height: 100%;
                        padding-bottom: 10px;
                        display: flex;
                        align-items: flex-end;
                        font-size: 20px;
                    }
                    .right {
                        width: calc(100% - 250px);
                        height: 100%;
                        padding-bottom: 10px;
                        display: flex;
                        align-items: flex-end;
                        justify-content: flex-end;                  
                    }
                }
                .tableContent {
                    width: 100%;
                    height: 70%;
                    font-weight: 500;
                    [color="未完成"]{
                        color: #898989;
                    }
                    [color="已完成"]{
                        color: #4bc65f;
                    }
                }
                .tableFooter {
                    width: 100%;
                    height: 10%;
                    padding: 0 15px;
                    display: flex;
                    align-items: center;
                    justify-content: space-between;
                    .left{
                        font-size: 12px;
                    }
                    .right{
                        display: flex;
                        gap:15px;
                        .jump{
                            .title{
                                margin-right: 5px;
                                font-size: 12px;
                            }
                            input{
                                width: 25px;
                                height: 25px;
                                text-align: center;
                                line-height: 25px;
                                border: none;
                                outline: none;
                                border-radius: 5px;
                                background-color: #f2f3f5;
                                color:#86909c;
                                &:focus{
                                    border: 1px solid #165dff;
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
</style>